
const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property([cc.Vec3])
    points: cc.Vec3 []= [];
    
    
    
    @property(cc.Vec2)
    c1:cc.Vec2=cc.v2();
    
    @property(cc.Vec2)
    c2:cc.Vec2=cc.v2();
    
    @property(cc.Graphics)
    graphics:cc.Graphics=null;

    @property
    speed:number=10;
    // onLoad () {}

    start () {
        let tween=cc.tween(this.node)
        tween.bezierTo(this.speed,this.c1,this.c2,cc.v2(this.points[0]));
        tween.start()
        
        this.graphics.strokeColor=(cc.Color.WHITE);
        this.graphics.moveTo(this.node.x,this.node.y);
        this.graphics.bezierCurveTo(this.c1.x,this.c1.y,this.c2.x,this.c2.y,this.points[0].x,this.points[0].y);
        this.graphics.stroke();
    }

    // update (dt) {}
}
